<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="__PLUGIN__/layer/layer.js"></script>
    <title>Title</title>
<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script></head>
<body>
<button onclick="ajax()">提交</button>
</body>
<script>
    function ajax() {
        $.ajax({
            type: "POST", //用POST方式传输
            dataType: "json", //数据格式:JSON
            url: "{:url('test37')}", //目标地址

            async: false,
            error: function (XMLHttpRequest, textStatus, errorThrown) {

            },
            success: function (data) {
                layer.msg(data.msg);
                if (data.code == 200) {
                    setTimeout(function () {
                        window.location.href = "{:url('')}";
                    }, 3000);
                } else {

                }

            }
        });
    }
</script>
</html>